﻿namespace ORS.OrderRobot
{
    /// <summary>
    /// 任务管理
    /// </summary>
    public interface IBackgroundWorkerManager
    {
        void Register<T>() where T : IBackgroundWorker;
        /// <summary>
        /// 开始所有任务
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task StartAllAsync(CancellationToken cancellationToken = default);
        /// <summary>
        /// 停止所有任务
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task StopAllAsync(CancellationToken cancellationToken = default);
        Task StartAsync(string workerName, CancellationToken cancellationToken = default);
        Task StopAsync(string workerName, CancellationToken cancellationToken = default);
    }
}

